<%--
  Created by IntelliJ IDEA.
  User: houcong
  Date: 14-4-16
  Time: xiawu9:24
  To change this template use File | Settings | File Templates.
  用于读取
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <%@include file="../../common/include_list_head.jsp" %>
    <script type="text/javascript">
        ///控制角色搜索按钮
        function butclick(appid) {
            var rolename = document.getElementById("rolesearch").value;
            var url = "./businessTabBut-list.action?rolename= " + rolename + "&&appid=" + appid;
            window.location.href(url);
        }
        /***
         *角色复制
         */
        function copyRole() {
            var msg = CropCheckBoxValueAsString("selectNode");//角色编号
            if (msg == '' || msg == null) {
                alert("请勾选要复制的角色");
                return false;
            }
            if (confirm("确认复制此角色？")) {
                var appId = '<s:property value="appid"/>';//系统编号

                if ("" != msg) {
                    /**************判断是否勾选了多条角色****************/
                    if (msg.indexOf(",") == -1) {
                        var windowWidth = document.body.clientWidth - 200;//弹出页面宽度
                        var windowHeight = document.body.clientHeight - 60;//弹出页面高度
                        if (windowWidth < 650) windowWidth += 160;
                        var uri = "../business/businessTabBut-copyRole.action?appId=" + appId + "&&roleId=" + msg;
                        top.zDiaglog.URL = uri;
                        top.zDiaglog.Width = windowWidth;
                        top.zDiaglog.Height = windowHeight + 40;
                        top.zDiaglog.ShowMaxButton = true;
                        top.zDiaglog.ShowMinButton = true;
                        top.zDiaglog.show();
                        return true;
                    } else {
                        alert("只能勾选一个角色！");
                        return false;
                    }
                }
            }
        }
    </script>
    <script type="text/javascript" src="${basePath }/component/datepicker/WdatePicker.js"></script>

</head>

<body>
<div id="scrollContent" style="height: 480px">

    <s:if test="actionErrors.size()>0 || actionMessages.size()>0 || fieldErrors.size()>0">
        <div id="SystemErrorMessage">
            <s:actionerror/>
            <s:actionmessage/>
            <s:fielderror/>
        </div>
    </s:if>
    <%-- 此form表单用于删除和改变状态和分页--%>
    <s:form name="ysform" method="post" theme="simple">
        <%--此参数用于分页--%>
        <s:hidden name="pager.formname" value="ysform"/>
        <s:hidden name="pager.currentPageno" id="yspager_currentPageno"/>

    </s:form>
    <s:if test="#type == 'menu'">
        <div id="userRoleMenuButton">
            <button onclick="openEntity(null,false,'type=${type}')"><span class="icon_add" title="">新增</span></button>
            <button onclick="doModify()"><span class="icon_edit" title="">修改</span></button>
            <button onclick="doRemove()"><span class="icon_delete" title="">删除</span></button>
            <button onclick="doUniChangeState(1,this)"><span class="icon_ok" title="">启用</span></button>
            <button onclick="doUniChangeState(0,this)"><span class="icon_no" title="">禁用</span></button>
            <button onclick="copyRole();"><span class="icon_item">角色复制</span></button>
            <s:property value="userRoleMenuButton" escape="false"/>
            <s:hidden name="changestate_parms" id="changestate_parms"
                      value="%{@com.apexedu.util.crypto.CipherUtil@encryptByAES('entityName:t_sys_role;idName:roleid')}"/>
        </div>
    </s:if>
    <div>
        <table class="tableStyle" headFixMode="true"
               useMultColor="false" useCheckBox="false">
            <tr>
                <th width="25"></th>
                <th width="200">
                    角色
                </th>
                <th width="100">
                    状态
                </th>
                <th>
                    描述
                </th>
            </tr>
            <s:iterator value="resultData">
                <tr>
                    <td width="25">
                        <s:checkbox id="%{wid}" name="selectNode" fieldValue="%{roleid}"/>
                    </td>
                    <td width="200">
                        <a href="javascript:openEntity('<s:property value="roleid"/>',false,'type=${type}')">
                            <font color="blue"><s:property value="rolename"/></font></a>
                    </td>
                    <td width="100">
                        <s:if test="state==0">禁用</s:if>
                        <s:else>可用</s:else>
                    </td>
                    <td>
                        &nbsp;<s:property value="memo"/>
                    </td>
                </tr>
            </s:iterator>
        </table>
    </div>
    <s:if test="rownum>15">
        <div style="height: 45px;">
            <div id="pagelist" style="display: none">
                <s:property value="pager.postToolBar" escape="false"/>
            </div>

            <div class="clear"></div>
        </div>
    </s:if>
</div>
</body>
</html>
